<?php
if (!defined('IN_CONTEXT')) die('access violation error!');
?>
<script type="text/javascript" language="javascript">
<!--
function delete_item(c_id)
{
	if(!c_id)
	{
		alert("Data is empty.");
	}
	else
	{
		if (confirm("想要删除这个检测项吗？"))
		{
			$("#stat").css({"display":"block"});
			$("#stat").html("正在保存内容......");
			_ajax_request('check',
					'doDeleteItem',
					{
						id: c_id
					},
					on_success,
					on_failure);
		}
	}
}

function on_success(response)
{
	response1 = eval("("+response+")");
	var stat = document.getElementById("stat");
	if(response1.result == 'ok')
	{
		alert(response1.sucmsg);
		stat.innerHTML = "OK，正在重定向......";
		reloadPage();
	}
	else if(response1.result == 'error')
	{
		stat.innerHTML = response1.errmsg;
	}
}

function on_failure(response)
{
	var stat = document.getElementById("stat");
	stat.innerHTML = response;
}
-->
</script>
<style type='text/css'>
table td {
	text-align:left;
}
</style>
<div id="stat" style="display:none;"></div>
<p style='margin-top:20px;font-size:12px;margin-bottom:2px;'><a href="<?php echo $add_item_address;?>">新增检测项</a></p>
<?php 
if(empty($items))
{
	echo "<p style='font-size:12px;'>Data is empty.</p>";
}
else
{
?>
<table width="100%" border="0" cellpadding="2" cellspacing="0" bordercolor="#4c4c4c">
<tr>
<td>序号</td>
<td>检测项类别</td>
<td>检测想描述</td>
<td>操作</td>
</tr>
<?php
	$i = 1;
	foreach($items as $v)
	{
		echo "<tr><td>$i</td><td>{$item_types[$v['c_type_id']]}</td><td>{$v['c_desc']}</td><td><a href='index.php?_m=check&_a=editItemPage&c_id={$v['c_id']}' title='编辑'><img src='./images/edit.gif' style='border:none;'/></a>&nbsp;<a onclick='delete_item({$v['c_id']});' href='#' title='删除'><img style='border:none;' src='./images/cross.gif'/></a></td></tr>";
		$i++;
	}
}
?>
</table>